import 'package:flutter/material.dart';
import 'val_ui_kit_base_decoration.dart';

class ValUIKitBtn extends StatelessWidget {
  const ValUIKitBtn(
      this.text,
      this.onTap, {
        Key? key,
        this.width,
        this.height,
        this.padding,
        this.decoration,
        this.inkWellHighlightShape = BoxShape.rectangle,
        this.inkWellHighlightColor = Colors.black12,
        this.inkWellSplashColor = Colors.black12,
        this.hasInkWell = true,
        this.inkWellBorderRadius = 90,
        this.inkWellRadius = 1000,
        this.constraints,
        this.alignment,
        this.onLongPress,
        this.onDoubleTap,
      }) : super(key: key);


  const ValUIKitBtn.item(
      this.text,
      this.onTap, {
        Key? key,
        this.width,
        this.height,
        this.padding,
        this.decoration,
        this.inkWellHighlightShape = BoxShape.rectangle,
        this.inkWellHighlightColor = Colors.black12,
        this.inkWellSplashColor = Colors.black12,
        this.hasInkWell = true,
        this.inkWellBorderRadius = 0,
        this.inkWellRadius = 1000,
        this.constraints,
        this.alignment,
        this.onLongPress,
        this.onDoubleTap,
      }) : super(key: key);

  ValUIKitBtn.shape(
      this.text,
      this.onTap, {
        Key? key,
        this.width,
        this.height,
        this.padding,
        this.inkWellHighlightShape = BoxShape.rectangle,
        this.inkWellHighlightColor = Colors.black12,
        this.inkWellSplashColor = Colors.black12,
        this.hasInkWell = true,
        this.inkWellRadius = 1000,
        this.constraints,
        this.alignment,
        this.onLongPress,
        this.onDoubleTap,
        Color? bg,
        double radius = 90,
        Color? borderColor,
        double borderWidth = 0.5,
        BorderStyle borderStyle = BorderStyle.solid,
      })  : inkWellBorderRadius = radius,
        decoration = ValUIKitBaseDecoration.getShapeDecoration(
            bg: bg, radius: radius, borderColor: borderColor, borderWidth: borderWidth, borderStyle: borderStyle),
        super(key: key);

  final Widget text;
  final Function() onTap;
  final EdgeInsetsGeometry? padding;
  final double? width;
  final double? height;
  final Decoration? decoration;
  final BoxShape inkWellHighlightShape;
  final Color inkWellHighlightColor;
  final Color inkWellSplashColor;
  final double inkWellBorderRadius;
  final double inkWellRadius;
  final bool hasInkWell;
  final BoxConstraints? constraints;
  final Alignment? alignment;
  final Function()? onLongPress;
  final Function()? onDoubleTap;

  @override
  Widget build(BuildContext context) {
    return Material(
      color: Colors.transparent,
      child: Ink(
        decoration: decoration,
        child: InkResponse(
          onTap: onTap,
          onLongPress: onLongPress,
          onDoubleTap: onDoubleTap,
          borderRadius: BorderRadius.all(Radius.circular(inkWellBorderRadius)),
          highlightShape: inkWellHighlightShape,
          highlightColor: hasInkWell ? inkWellHighlightColor : Colors.transparent,
          splashColor: hasInkWell ? inkWellSplashColor : Colors.transparent,
          radius: hasInkWell ? inkWellRadius : 0,
          containedInkWell: true,
          child: Container(
            width: width,
            height: height,
            padding: padding,
            constraints: constraints,
            alignment: alignment,
            child: text,
          ),
        ),
      ),
    );
  }
}
